<?php

/**
 * PieceJointe form base class.
 *
 * @method PieceJointe getObject() Returns the current form's model object
 *
 * @package    symfony
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePieceJointeForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                        => new sfWidgetFormInputHidden(),
      'nom'                       => new sfWidgetFormInputText(),
      'emplacement'               => new sfWidgetFormInputText(),
      'contenu'                   => new sfWidgetFormTextarea(),
      'taille'                    => new sfWidgetFormInputText(),
      'id_categorie_piece_jointe' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CategoriePieceJointe'), 'add_empty' => false)),
      'created_at'                => new sfWidgetFormDateTime(),
      'updated_at'                => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                        => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'nom'                       => new sfValidatorString(array('max_length' => 50)),
      'emplacement'               => new sfValidatorString(array('max_length' => 50)),
      'contenu'                   => new sfValidatorString(array('max_length' => 1000)),
      'taille'                    => new sfValidatorInteger(),
      'id_categorie_piece_jointe' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('CategoriePieceJointe'))),
      'created_at'                => new sfValidatorDateTime(),
      'updated_at'                => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('piece_jointe[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'PieceJointe';
  }

}
